<template>
	<div class="show-info">name: {{ name }} age: {{ age }} height: {{ height }}</div>
	<!-- 直接修改从inject获取的数据没有响应式 -->
	<button @click="name = 'ls'">修改inject数据</button>
</template>

<script>
import { inject } from 'vue'

export default {
	setup() {
		const name = inject('name')
		const age = inject('age')
		// inject 默认值
		const height = inject('height', 100)

		return {
			name,
			age,
			height,
		}
	},
}
</script>

<style scoped></style>
